pub fn touch_var() {
    let equation = read_equation();
    let mut set = HashSet::new();
    equation.count_vals(&mut set);
    app.val_ranges
        .extend(set.iter().map(|s| (s.to_owned(), -3.0..3.0))); // 添加默认参数范围
    app.messages.push(format!("{}={equation}", &app.item));
    app.equations.insert(app.item.to_string(), equation.clone());
    if set.len() == 2 {
        render_two_para_func(equation, app.val_ranges.clone());
    }
}
pub fn render_demo() {
    let mut local_vertex = vec![Vertex::zero()];
    let mut local_normal = vec![Normal::zero()];
    let mut local_index: Vec<u16> = vec![];
    // counter clock-wise
    // first show with lower depth, cover other things?
    // red center in x-y plain
    let (mut v, mut n, i) = construct_square(
        (-0.5, -0.5, 0.0),
        (-0.5 + 1.0, -0.5, 0.0),
        (0.5, 0.5, 0.0),
        (-0.5, 0.5, 0.0),
        [1.0, 0.0, 0.0, 1.0],
    );

    local_index.append(
        &mut i
            .iter()
            .map(|x| x + local_vertex.len() as u16 - 1)
            .collect(),
    );
    local_vertex.append(&mut v);
    local_normal.append(&mut n);

    // green some?
    let (mut v, mut n, i) = construct_arc_face(
        [0.0, 1.0, 0.0],
        [1.0, 1.0, 0.0],
        [1.0, 0.0, 1.0],
        [0.0, 0.0, 1.0],
        [0.5, 0.5, 0.0], //center // FIXME 拼贴痕迹太明显？
        [0.0, 1.0, 0.0, 1.0],
    );
    local_index.append(
        &mut i
            .iter()
            .map(|x| x + local_vertex.len() as u16 - 1)
            .collect(),
    );
    local_vertex.append(&mut v);
    local_normal.append(&mut n);

    expand_xy_plain(
        -3..3,
        -3..3,
        &mut local_index,
        &mut local_vertex,
        &mut local_normal,
    );
    println!("Index:\n{local_index:?}\n");
    println!("Vertex:\n{local_vertex:?}\n");
    println!("normal:\n{local_normal:?}\n");

    // u16? 65535 triangles.
    vul_render(&local_index, &local_normal, &local_vertex);
}
pub fn expression_demo() {
    let mut func_expr: String = String::new();
    stdin().read_line(&mut func_expr).unwrap();
    let func_expr = func_expr.trim().to_string();
    let ast = Parser::new(TokStr::new(func_expr.clone()))
        .parse_expr()
        .unwrap();
    let mut environment: HashMap<String, Expr> = HashMap::new();
    environment.insert("x".to_string(), Expr::Cstf(1.0));
    let result = Evaluator::eval_expr(&ast, &environment);
    println!("{ast}={result}");
}
